import Vue from 'vue';
import VueRouter from 'vue-router';
// import Login from '../views/login/index.vue';
import Login from '../views/login';
import LayOut from '@/components/LayOut.vue';
import Home from '@/views/home';
import Member from '@/views/member';
import Supplier from '@/views/supplier';
import Goods from '@/views/goods';
import Staff from '@/views/staff';

Vue.use(VueRouter);

// //路由配置
// const routes = [];

// const router = new VueRouter({
//     // mode: "history",
//     base: process.env.BASE_URL,
//     routes
// });

// export default router;

export default new VueRouter({
    routes: [{
            name: 'login',
            path: '/login',
            component: Login
        },
        {
            name: 'layOut',
            path: '/',
            component: LayOut,
            children: [{

                path: '/home', //既可以是绝对路由地址 又可以是相对路由地址
                component: Home,
                meta: {
                    title: '首页'
                },

            }],
            redirect: '/home'
        },
        {
            path: '/member',
            component: LayOut,
            children: [{
                path: '/',
                component: Member,
                meta: { title: '会员管理' }
            }]


        },
        {
            path: '/supplier',
            component: LayOut,
            children: [{
                path: '/',
                component: Supplier,
                meta: { title: '供应商管理' }
            }]


        }, {
            path: '/goods',
            component: LayOut,
            children: [{
                path: '/',
                component: Goods,
                meta: { title: '商品管理' }
            }]


        }, {
            path: '/staff',
            component: LayOut,
            children: [{
                path: '/',
                component: Staff,
                meta: { title: '员工管理' }
            }]


        }
    ]
});